# Vga matrix demo
#
# read the instructions in vgamatrix.include.pcl

screen_width     = 1024;
screen_height    = 768;
screen_bit_depth = 32;

begin;

# PCL code
begin_pcl;

# which serial port to use for the vga matrix (use 0 when not connected)
int matrix_port_number = 1;

# include vgamatrix library
include "vgamatrix.include.pcl";

# definition of constants
# -----------------------

# vga sources
int input_presentation_left  = 1;
int input_presentation_right = 2;
int input_briocam            = 3;
int input_eyetracker         = 4;

# vga outputs
int output_mri               = 1;
int output_brio              = 2;

# audio sources
int input_mri_mic            = 1;

# audio outputs
int output_brio_speaker      = 1;
# -----------------------


# safe start
# unmute all video outputs
VGAmatrix_unmute_all("video");

# unmute all audio outputs
VGAmatrix_unmute_all("audio");

VGAmatrix_set_audio_output_level(output_brio_speaker, "consumer");

VGAmatrix_connect(input_mri_mic, output_brio_speaker, "audio");

/*
# toggle audio on and off
loop until false
begin
	term.print("mute speaker\n");
	VGAmatrix_mute(output_brio_speaker, "audio");
	
	wait_interval(3000);
	
	term.print("unmute speaker\n");
	VGAmatrix_unmute(output_brio_speaker, "audio");
	
	wait_interval(3000);
end;
*/
VGAmatrix_unlock_frontpanel();

# let's do some switching in an endless loop
loop until false
begin
	term.print("showing presentation_left on mri screen\n");
	VGAmatrix_connect(input_presentation_left, output_mri, "video");

	wait_interval(3000);
		
	term.print("showing briocam on mri screen\n");
	VGAmatrix_connect(input_briocam , output_mri, "video");

	wait_interval(3000);
	
	term.print("showing eyetracker on mri screen\n");
	VGAmatrix_connect(input_eyetracker, output_mri, "video");
	
	wait_interval(3000);
end;